<!DOCTYPE html>




<html class="theme-next gemini" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



  <meta name="google-site-verification" content="vjImUBDCK8Rg9G13vkIip_GUsZTtVV6s-XdSk81-jzA" />













  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.lug.ustc.edu.cn/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Android,Xposed," />





  <link rel="alternate" href="/atom.xml" title="旺仔的个人博客" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.png?v=5.1.2" />






<meta name="description" content="缘由不知道大家有没有用过QQ/TIM登录的时候使用扫描二维码登录的功能呢？ 也就是登录界面的右下角那里有个二维码的按钮  点击之后就会出现二维码  然后用手机QQ/TIM打开扫一扫界面，扫了之后，会弹出允许登录的界面  然后我们需要点击允许登录TIM/QQ，电脑端就登录成功了。 但是每次登录都要点击允许登录，我觉得好麻烦，所以就实现了自动点击功能，这篇文章就是来介绍如何使用Xposed来实现自动点">
<meta name="keywords" content="Android,Xposed">
<meta property="og:type" content="article">
<meta property="og:title" content="使用Xposed实现QQ&#x2F;TIM自动确认电脑扫一扫登录">
<meta property="og:url" content="http://www.jowanxu.top/2017/10/12/使用Xposed实现QQ-TIM自动确认电脑扫一扫登录/index.html">
<meta property="og:site_name" content="旺仔的个人博客">
<meta property="og:description" content="缘由不知道大家有没有用过QQ/TIM登录的时候使用扫描二维码登录的功能呢？ 也就是登录界面的右下角那里有个二维码的按钮  点击之后就会出现二维码  然后用手机QQ/TIM打开扫一扫界面，扫了之后，会弹出允许登录的界面  然后我们需要点击允许登录TIM/QQ，电脑端就登录成功了。 但是每次登录都要点击允许登录，我觉得好麻烦，所以就实现了自动点击功能，这篇文章就是来介绍如何使用Xposed来实现自动点">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/39030174.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/10887695.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/23112283.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/85446414.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/36788537.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/8005891.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/71188405.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/19249696.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/48102393.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/7356051.jpg">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/1507769568020.gif">
<meta property="og:image" content="http://ovlhlis72.bkt.clouddn.com/20171016_094919.gif">
<meta property="og:updated_time" content="2017-11-29T00:19:28.237Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用Xposed实现QQ&#x2F;TIM自动确认电脑扫一扫登录">
<meta name="twitter:description" content="缘由不知道大家有没有用过QQ/TIM登录的时候使用扫描二维码登录的功能呢？ 也就是登录界面的右下角那里有个二维码的按钮  点击之后就会出现二维码  然后用手机QQ/TIM打开扫一扫界面，扫了之后，会弹出允许登录的界面  然后我们需要点击允许登录TIM/QQ，电脑端就登录成功了。 但是每次登录都要点击允许登录，我觉得好麻烦，所以就实现了自动点击功能，这篇文章就是来介绍如何使用Xposed来实现自动点">
<meta name="twitter:image" content="http://ovlhlis72.bkt.clouddn.com/17-10-16/39030174.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: false,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://www.jowanxu.top/2017/10/12/使用Xposed实现QQ-TIM自动确认电脑扫一扫登录/"/>





  <title>使用Xposed实现QQ/TIM自动确认电脑扫一扫登录 | 旺仔的个人博客</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>
    <a href="https://github.com/wangzailfm"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">旺仔的个人博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">叫我旺仔<br/>Android Developer</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://www.jowanxu.top/2017/10/12/使用Xposed实现QQ-TIM自动确认电脑扫一扫登录/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jowan">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="旺仔的个人博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用Xposed实现QQ/TIM自动确认电脑扫一扫登录</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-10-12T17:51:55+08:00">
                2017-10-12
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2017-11-29T08:19:28+08:00">
                2017-11-29
              </time>
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Xposed/" itemprop="url" rel="index">
                    <span itemprop="name">Xposed</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"> 文章热度</i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>°C
            </span>
          

          
            <br/>
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">文章字数</span>
                
                <span title="文章字数">
                  1,212 字
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长需</span>
                
                <span title="阅读时长需">
                  5 分钟
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="缘由"><a href="#缘由" class="headerlink" title="缘由"></a>缘由</h2><p>不知道大家有没有用过QQ/TIM登录的时候使用扫描二维码登录的功能呢？</p>
<p>也就是登录界面的右下角那里有个二维码的按钮</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/39030174.jpg" alt=""></p>
<p>点击之后就会出现二维码</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/10887695.jpg" alt=""></p>
<p>然后用手机QQ/TIM打开扫一扫界面，扫了之后，会弹出允许登录的界面</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/23112283.jpg" alt=""></p>
<p>然后我们需要点击允许登录TIM/QQ，电脑端就登录成功了。</p>
<p>但是每次登录都要点击允许登录，我觉得好麻烦，所以就实现了自动点击功能，这篇文章就是来介绍如何使用Xposed来实现自动点击。</p>
<a id="more"></a>
<h2 id="实践"><a href="#实践" class="headerlink" title="实践"></a>实践</h2><p>首先我们先整理一下思路，先要获取确认登录界面的Class，然后获取允许登录这个控件的Field，然后通过调用<code>performClick</code>这个方法来实现点击。</p>
<h3 id="查找确认登录Activity"><a href="#查找确认登录Activity" class="headerlink" title="查找确认登录Activity"></a>查找确认登录Activity</h3><p>接下来，我们需要获取确认登录界面的Activity是哪一个，在这里我们先下载一个软件<a href="https://www.coolapk.com/apk/com.toshiba.packagenamedetector" target="_blank" rel="external">当前界面</a>，可以获取到当前界面的Activity</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/85446414.jpg" alt=""></p>
<p>在这里我们找到了确认界面的Activity的类名是<code>com.tencent.biz.qrcode.activity.QRLoginActivity</code>，然后我们进行下一步</p>
<h3 id="反编译classes-dex"><a href="#反编译classes-dex" class="headerlink" title="反编译classes.dex"></a>反编译classes.dex</h3><p>当前使用的apk版本是2.0.0，然后改后缀，打开压缩包，复制里面的<code>dex</code>文件</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/36788537.jpg" alt=""></p>
<p>然后通过<code>dex2jar</code>将<code>dex</code>转换成<code>jar</code>文件，然后用<code>jd-gui</code>打开<code>jar</code>包，最后在<code>classes6-dex2jar.jar</code>里面找到<code>QRLoginActivity</code>类</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/8005891.jpg" alt=""></p>
<h3 id="使用AndroidKiller"><a href="#使用AndroidKiller" class="headerlink" title="使用AndroidKiller"></a>使用AndroidKiller</h3><p>由于我们需要获取控件相关的内容，就需要获取控件的id、text之类的东西，那么仅仅靠<code>dex2jar</code>和<code>jd-gui</code>两个东西是完成不了的，所以这里我们需要用到<code>AndroidKiller</code>，<a href="http://down.52pojie.cn/Tools/Android_Tools/AndroidKiller_v1.3.1.zip" target="_blank" rel="external">AndroidKiller</a>是一款可视化的安卓应用逆向工具，具体使用，大家自行上网搜索，这里不介绍。</p>
<h4 id="获取text引用"><a href="#获取text引用" class="headerlink" title="获取text引用"></a>获取text引用</h4><p>将我们的TIM的apk打开，然后搜索<code>允许登录</code>内容，找到对应的16进制内容</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/71188405.jpg" alt=""></p>
<p>找到之后，发现有两个16进制的值，一个是<code>7f0a0872</code>，一个是<code>7f0a0ba9</code>，既然有两个，那么就有分别去搜索这两个值的调用，我这里有搜索过，第二个才是我们需要的，我们来看搜索结果</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/19249696.jpg" alt=""></p>
<p>可以看出，这个值的引用是在<code>hxq</code>类上面调用的，点开<code>jd-gui</code>，找到这个类，同样是在<code>classes6-dex2jar.jar</code>里面</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/48102393.jpg" alt=""></p>
<p>可以看出这个类是个<code>Handler</code>类，那么我们就可以这样理解，当扫描二维码后，会调用<code>sendMessage</code>之类的方法，然后在<code>handleMessage</code>里面进行修改控件的Text值。</p>
<h3 id="Hook方法"><a href="#Hook方法" class="headerlink" title="Hook方法"></a>Hook方法</h3><p>通过上面的说明，我们可以很明确的知道该hook的地方在哪里了：</p>
<ol>
<li>首先我们需要将Hook控件初始化的方法，然后再Hook我们的<code>hxq</code>类里面的<code>handleMessage</code>方法</li>
<li>之后进行判断控件的值是不是包含<code>允许登录</code>的内容(因为二维码过期我们不需要进行处理，只有登录的时候才进行处理)，如果包含的话就调用<code>performClick</code>这个方法实现点击。</li>
</ol>
<h4 id="找到初始化方法"><a href="#找到初始化方法" class="headerlink" title="找到初始化方法"></a>找到初始化方法</h4><p>如何找到初始化方法呢，通过搜索<code>findviewbyid</code>，找到了<code>doOnCreate</code>方法</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/17-10-16/7356051.jpg" alt=""></p>
<p>然后我们Hook这个方法<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// 获取Class</span></div><div class="line"><span class="keyword">final</span> Class&lt;?&gt; aClass = XposedHelpers.findClassIfExists(<span class="string">"com.tencent.biz.qrcode.activity.QRLoginActivity"</span>, lpparam.classLoader);</div><div class="line"><span class="keyword">if</span> (aClass == <span class="keyword">null</span>) &#123;</div><div class="line">    <span class="keyword">return</span>;</div><div class="line">&#125;</div><div class="line"><span class="comment">// Hook指定方法</span></div><div class="line">XposedHelpers.findAndHookMethod(aClass, <span class="string">"doOnCreate"</span>, Bundle.class, <span class="keyword">new</span> XC_MethodHook() &#123;</div><div class="line">    <span class="meta">@Override</span></div><div class="line">    <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">afterHookedMethod</span><span class="params">(MethodHookParam param)</span> <span class="keyword">throws</span> Throwable </span>&#123;</div><div class="line">        <span class="comment">// 操作</span></div><div class="line">    &#125;</div><div class="line">&#125;);</div></pre></td></tr></table></figure></p>
<h4 id="反射获取控件"><a href="#反射获取控件" class="headerlink" title="反射获取控件"></a>反射获取控件</h4><p>通过获取<code>QRLoginActivity</code>的Class之后，我们通过反射获取里面的所有变量，然后通过判断变量的类型，然后判断控件的Text值是否包含<code>允许登录</code>内容，然后实现点击。<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">for</span> (Field declaredField : declaredFields) &#123;</div><div class="line">    <span class="comment">// 设置true</span></div><div class="line">    declaredField.setAccessible(<span class="keyword">true</span>);</div><div class="line">    <span class="comment">// 判断类型是否是Button</span></div><div class="line">    <span class="keyword">if</span> (declaredField.getGenericType().toString().contains(<span class="string">"android.widget.Button"</span>)) &#123;</div><div class="line">        <span class="comment">// 获取值</span></div><div class="line">        <span class="keyword">final</span> Button loginButton = (Button) declaredField.get(param.thisObject);</div><div class="line">        <span class="keyword">if</span> (loginButton == <span class="keyword">null</span>) &#123;</div><div class="line">            <span class="keyword">return</span>;</div><div class="line">        &#125;</div><div class="line">        <span class="comment">// 默认的Button的Text为空，需要在Handler这个类里面的方法后面加上判断</span></div><div class="line">        Class&lt;?&gt; handlerClass = XposedHelpers.findClassIfExists(resultStr, lpparam.classLoader);</div><div class="line">        <span class="keyword">if</span> (handlerClass == <span class="keyword">null</span>) &#123;</div><div class="line">            <span class="keyword">return</span>;</div><div class="line">        &#125;</div><div class="line">        <span class="keyword">try</span> &#123;</div><div class="line">            <span class="comment">// Hook方法，对handleMessage方法调用后，进行判断Button的Text进行判断，并且自动调用点击方法</span></div><div class="line">            XposedHelpers.findAndHookMethod(handlerClass, <span class="string">"handleMessage"</span>, Message.class, <span class="keyword">new</span> XC_MethodHook() &#123;</div><div class="line">                <span class="meta">@Override</span></div><div class="line">                <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">afterHookedMethod</span><span class="params">(MethodHookParam param)</span> <span class="keyword">throws</span> Throwable </span>&#123;</div><div class="line">                    <span class="comment">// 当Button的Text为允许登录TIM/允许登录QQ的时候才实现点击</span></div><div class="line">                    <span class="keyword">if</span> (loginButton.getText().toString().contains(<span class="string">"允许登录"</span>)) &#123;</div><div class="line">                        loginButton.performClick();</div><div class="line">                    &#125;</div><div class="line">                &#125;</div><div class="line">            &#125;);</div><div class="line">        &#125; <span class="keyword">catch</span> (Throwable t) &#123;</div><div class="line">            XposedBridge.log(<span class="string">"Hook 出错 "</span> + t);</div><div class="line">        &#125;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>最后打包，安装，激活重启</p>
<h4 id="结果："><a href="#结果：" class="headerlink" title="结果："></a>结果：</h4><p><img src="http://ovlhlis72.bkt.clouddn.com/1507769568020.gif" alt="扫一扫登录"></p>
<h3 id="结语"><a href="#结语" class="headerlink" title="结语"></a>结语</h3><p>文章说的简单一点，实际上自己反编译并且查找内容，是一个比较繁琐的事情，明确的方向会减轻需要操作的步骤。</p>
<h2 id="微信自动确认登录"><a href="#微信自动确认登录" class="headerlink" title="微信自动确认登录"></a>微信自动确认登录</h2><p>同样我们可以实现自动确认电脑端登录，这里就不再介绍了，大家可以自己试一试：</p>
<p><img src="http://ovlhlis72.bkt.clouddn.com/20171016_094919.gif" alt="自动确认电脑端登录"></p>
<h2 id="GitHub"><a href="#GitHub" class="headerlink" title="GitHub"></a>GitHub</h2><p>Github地址在此奉上：<a href="https://github.com/wangzailfm/ScanLogin" target="_blank" rel="external">ScanLogin</a>，欢迎star</p>

      
    </div>
    
    
    

    

    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    Jowan
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://www.jowanxu.top/2017/10/12/使用Xposed实现QQ-TIM自动确认电脑扫一扫登录/" title="使用Xposed实现QQ/TIM自动确认电脑扫一扫登录">http://www.jowanxu.top/2017/10/12/使用Xposed实现QQ-TIM自动确认电脑扫一扫登录/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Android/" rel="tag"><i class="fa fa-tag"></i> Android</a>
          
            <a href="/tags/Xposed/" rel="tag"><i class="fa fa-tag"></i> Xposed</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/29/使用Xposed去除微博国际版的启动广告/" rel="next" title="使用Xposed去除微博国际版的启动广告">
                <i class="fa fa-chevron-left"></i> 使用Xposed去除微博国际版的启动广告
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/10/23/Android7.0快速设置磁贴/" rel="prev" title="Android 7.0快速设置磁贴（Quick Setting Tile）">
                Android 7.0快速设置磁贴（Quick Setting Tile） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zMjA1My84NjE3"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="Jowan" />
          <p class="site-author-name" itemprop="name">Jowan</p>
           
              <p class="site-description motion-element" itemprop="description">叫我旺仔<br/>Android Developer</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">31</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">5</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">27</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://plus.google.com/u/0/111824269044709365866" target="_blank" title="Google">
                  
                    
                      Google
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://github.com/wangzailfm" target="_blank" title="GitHub">
                  
                    
                      GitHub
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/809077554" target="_blank" title="微博">
                  
                    
                      微博
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="673173629@qq.com" target="_blank" title="E-Mail">
                  
                    
                      E-Mail
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://blog.csdn.net/u011976726" target="_blank" title="CSDN">
                  
                    
                      CSDN
                    
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://www.jianshu.com/u/5509a21c1623" target="_blank" title="简书">
                  
                    
                      简书
                    
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-block">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://wanandroid.com/" title="WanAndroid" target="_blank">WanAndroid</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#缘由"><span class="nav-number">1.</span> <span class="nav-text">缘由</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#实践"><span class="nav-number">2.</span> <span class="nav-text">实践</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#查找确认登录Activity"><span class="nav-number">2.1.</span> <span class="nav-text">查找确认登录Activity</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#反编译classes-dex"><span class="nav-number">2.2.</span> <span class="nav-text">反编译classes.dex</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用AndroidKiller"><span class="nav-number">2.3.</span> <span class="nav-text">使用AndroidKiller</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#获取text引用"><span class="nav-number">2.3.1.</span> <span class="nav-text">获取text引用</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hook方法"><span class="nav-number">2.4.</span> <span class="nav-text">Hook方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#找到初始化方法"><span class="nav-number">2.4.1.</span> <span class="nav-text">找到初始化方法</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#反射获取控件"><span class="nav-number">2.4.2.</span> <span class="nav-text">反射获取控件</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#结果："><span class="nav-number">2.4.3.</span> <span class="nav-text">结果：</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#结语"><span class="nav-number">2.5.</span> <span class="nav-text">结语</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#微信自动确认登录"><span class="nav-number">3.</span> <span class="nav-text">微信自动确认登录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#GitHub"><span class="nav-number">4.</span> <span class="nav-text">GitHub</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Jowan</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Gemini
  </a>
</div>


        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user">本站访客数</i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      人次
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye">本站总访问量</i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      次
    </span>
  
</div>


        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  






  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  

  

  

</body>
</html>
